anyone familiar with C++

Search

New member
Joined
Oct 18, 2005
Messages
426
Tokens
I was trying to learn C++ last year but made a feeble attempt and decided to try and learn it and i will be taking classes on it in a couple semesters. but anyways, i would like it if someone could show me how to perform a basic operation, like adding 2 numbers.
here's what i have so far but it obviously isn't correct:

#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs [])
{int n1 = 1;
int n2 = 2;
cout << "int n1 + int n2" << endl;
system ("PAUSE") ;
return 0;
}
obviously when all this program returns is
"int n1 + int n2" press any key to continue...

i'm making some obvious elementary error, anyone willing to help thank you
 

Programmer
Joined
Sep 21, 2004
Messages
3,441
Tokens
Why don't you start with C# or Java instead.

There are very few applications that require you get into C++ development anymore. Even portable devices (phones, PDAs) are moving to "managed" code.
 

New member
Joined
Oct 18, 2005
Messages
426
Tokens
oh okay thanks for the advice. i plan on taking a class on java before going into C++ if that is even necessary. is c# a lot simpler than c++?... because so far c++ seems quite complex, maybe since i'm trying to learn it out of a book
 

New member
Joined
Oct 19, 2005
Messages
3,267
Tokens
newb411breaker19 said:
I was trying to learn C++ last year but made a feeble attempt and decided to try and learn it and i will be taking classes on it in a couple semesters. but anyways, i would like it if someone could show me how to perform a basic operation, like adding 2 numbers.
here's what i have so far but it obviously isn't correct:

#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs [])
{int n1 = 1;
int n2 = 2;
cout << "int n1 + int n2" << endl;
system ("PAUSE") ;
return 0;
}
obviously when all this program returns is
"int n1 + int n2" press any key to continue...

i'm making some obvious elementary error, anyone willing to help thank you

Sorry, just found this thread today.

I am still a big fan of C, not C# or Java.

#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int n1 = 1;
int n2 = 2;
cout << n1 + n2 << endl;
system ("PAUSE") ;
return 0;
}
 
Joined
Sep 21, 2004
Messages
28,775
Tokens
It took less than 1 attempt at a college level C++ class for me to learn that programming was NOT my gig!!!!!
 

New member
Joined
Dec 22, 2004
Messages
439
Tokens
I dont recommend taking up a class for programming unless you wish to make a career out of it. Because there is too much too learn.. seriously not even the creator of C himself can claims that he knows 100% of C.

If you know C++, you already know 50% of Java. I suggest you start by learning from basic book like learn C++ in 21 days after you finish it, than you buy more advance C++ book from there you move up slowly, you cant rush when it comes in mastering programming.
 

New member
Joined
Oct 19, 2005
Messages
3,267
Tokens
Moving from C to just about any language is easier than the other way around.
 

New member
Joined
Oct 17, 2006
Messages
3
Tokens
Depending on what you want to do, I find that Visual Basic is much much easier to learn on your own. I use the Visual Basic editor within Excel and have found you can do just about anything you could ever want or need to.

Just my opinion.
 

Forum statistics

Threads
1,119,832
Messages
13,573,830
Members
100,876
Latest member
kiemt5385
The RX is the sports betting industry's leading information portal for bonuses, picks, and sportsbook reviews. Find the best deals offered by a sportsbook in your state and browse our free picks section.FacebookTwitterInstagramContact Usforum@therx.com